package com.baizhi.service;

import com.baizhi.dao.EuserDao;
import com.baizhi.entity.Euser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class EuserServiceimpl implements EuserService{

    @Autowired
    private EuserDao euserDao;


    @Override
    @Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
    public int queryEuser(Euser euser) {
        Euser euser2 = euserDao.queryEuser(euser.getUsername());
        if( euser2 == null ) return 2;
        if( euser.getPassword().equals( euser2.getPassword())== false ) return 3;
        return 1;
    }

    @Override
    public void addEuser(Euser euser) {
        euserDao.addEuser(euser);
    }
}
